package com.ck.ips.model.vo;

import com.ck.core.annotation.Children;
import com.ck.core.annotation.Id;
import com.ck.core.annotation.ParentId;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.List;

/**
* @Description: 树形结构、分层级构建树形结构
* @Author: hf
* @Date:    2019/5/8 16:38
* @Version: 1.0
*/
public class TreeHierarchyVO implements Serializable{

    private static final long serialVersionUID = 2154475051306494914L;
    /** 终端分组主键 */
    @Id
    private Long id;
    /** 父主键 */
    @ParentId
    private String parentId;
    /** 名称 */
    private String name;
    /**
     * 是否选中
     */
    private Boolean checked;
    /**
     * 是否为叶子节点
     */
    private Boolean leaf;
    /**
     * 子分组
     */
    @Children
    private List<TreeHierarchyVO> children;

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getChecked() {
        return checked;
    }

    public void setChecked(Boolean checked) {
        this.checked = checked;
    }

    public Boolean getLeaf() {
        return children == null || children.isEmpty();
    }

    public void setLeaf(Boolean leaf) {
        this.leaf = leaf;
    }

    public List<TreeHierarchyVO> getChildren() {
        return children;
    }

    public void setChildren(List<TreeHierarchyVO> children) {
        this.children = children;
    }

    @Override
    public String toString() {
        return "TreeHierarchyVO{" +
                "id=" + id +
                ", parentId='" + parentId + '\'' +
                ", name='" + name + '\'' +
                ", checked=" + checked +
                ", leaf=" + leaf +
                ", children=" + children +
                '}';
    }
}
